<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        ul {
            list-style: none;
        }
        
        li {
            width: 100px;
            float: left;
            border: 1px solid black;
            text-align: center;
        }
        
        .active {
            background: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="item,index in list" :class="current===index ? 'active' : ''" @click="change(index)">
                {{item}}
            </li>
        </ul>

    </div>
</body>

<script>
    var vm = new Vue({
        el: "#app",
        data: {
            list: ["首页", "商品", "详情"],
            current: 0

        },
        methods: {
            change(index) {
                this.current = index;
            }
        }
    })
</script>

</html>